package org.example.video.strategy;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.example.commonapi.domain.Video;

// VideoSortType.java （枚举实现策略模式）
public enum VideoSortType implements VideoSortStrategy {
    PLAY_COUNT {
        @Override
        public void applySort(LambdaQueryWrapper<Video> queryWrapper) {
            queryWrapper.orderByDesc(Video::getPlayCount);
        }
    },
    CREATE_TIME {
        @Override
        public void applySort(LambdaQueryWrapper<Video> queryWrapper) {
            queryWrapper.orderByDesc(Video::getCreateTime);
        }
    };

    // 提供默认排序方式
    public static VideoSortType defaultSort() {
        return PLAY_COUNT;
    }
}